import { useUserStore } from '@/stores'

export const permissionDirectory = {
    mounted(el, binding) {
        const userStore = useUserStore()
        // console.log(binding.value, userStore.user.roleList);
        const hasPermission = checkPermission(binding.value, userStore.user.roleList)

        if (!hasPermission) {
            el.style.display = 'none'
        }
    }
}

function checkPermission(value, userRoles) {
    if (userRoles[0].roleId === value) {
        return true
    }
    return false
}
